package com.utils.wechat;

import com.base.Constants;
import com.bean.wechat.ResultInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.Map;

@Service
public class WechatStrategyFactory {

    @Resource(name = "wechatStrategyFunction")
    private WechatStrategy wechatStrategyFunction;

    @Resource(name = "wechatStrategyBind")
    private WechatStrategy wechatStrategyBind;

    @Resource(name = "wechatStrategyLogintoken")
    private WechatStrategy wechatStrategyLogintoken;

    @Resource(name = "wechatStrategyJokes")
    private WechatStrategy wechatStrategyJokes;

    @Resource(name = "wechatStrategyFreeApiTu")
    private WechatStrategy wechatStrategyFreeApiTu;

    @Resource(name = "wechatStrategyServer")
    private WechatStrategy wechatStrategyServer;

    @Resource(name = "wechatStrategyRiddle")
    private WechatStrategy wechatStrategyRiddle;

    @Resource(name = "wechatStrategyQpdh")
    private WechatStrategy wechatStrategyQpdh;

    public void getResultInfo(ResultInfo resultInfo,String content, Constants constants){

        switch (constants){
            case WechatBind:
                //resultInfo.setReturnMethod("text");
                wechatStrategyBind.returnMsg(resultInfo,content);
                break;
            case WechatLogintoken:
                //resultInfo.setReturnMethod("news");
                wechatStrategyLogintoken.returnMsg(resultInfo,content);
                break;
            case WechatFunction:
                wechatStrategyFunction.returnMsg(resultInfo,content);
                break;
            case WechatJokes:
                wechatStrategyJokes.returnMsg(resultInfo,content);
                break;
            case WechatFreeApiTu:
                wechatStrategyFreeApiTu.returnMsg(resultInfo,content);
                break;
            case WechatServer:
                wechatStrategyServer.returnMsg(resultInfo,content);
                break;
            case WechatRiddle:
                wechatStrategyRiddle.returnMsg(resultInfo,content);
                break;
            case WechatQpdh:
                wechatStrategyQpdh.returnMsg(resultInfo,content);
                break;
            default:
                throw new IllegalStateException("Unexpected value: " + constants);
        }
    }

}
